
package controllers;

/**
 *
 * @author john
 */
public class HelpContentControl {
    
    public final static String URL="http://f6-preview.awardspace.com/tecnodevelop.com/as/AS-documentation.html";
    
    /**
     * 
     * @return 
     */
    public static boolean openDocumentation(){
        String nombreSO=System.getProperty("os.name");
        try{
            if(nombreSO.startsWith("Mac OS")){
                Class manager = Class.forName("com.apple.eio.FileManager");
                java.lang.reflect.Method openURL = manager.getDeclaredMethod("openURL", new Class[] {String.class});
                openURL.invoke(null, new Object[] {URL});
            }
            else if(nombreSO.startsWith("Windows"))
                Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+URL);
            else{
                String[] navegadores={"firefox", "chrome", "opera", "konqueror", "epiphany", "mozilla", "netscape" };
                String navegador=null;
                for(int contador=0;contador<navegadores.length && navegador==null;contador++)
                    if(Runtime.getRuntime().exec(new String[]{"which",navegadores[contador]}).waitFor()==0)
                        navegador=navegadores[contador];
                if (navegador==null)
                    throw new Exception("No se encuentra navegador web");
                else
                    Runtime.getRuntime().exec(new String[] {navegador, URL});
            }
        }catch(Exception e){
            return false;
        }
        return true;
    }
    
}